﻿/*
 * Cratos Tools - General
 * Cratos Data Object Collection Interface declaration
 * 
 * Copyright (c) 2011-212 Draco
 * 
 * This file is part of Cratos.
 * 
 * Cratos is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * Cratos is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Cratos.  If not, see <http://www.gnu.org/licenses/>.
 * 
 *       .==.        .==.
 *      //'^\\      //^'\\
 *     // ^ ^\(\__/)/^ ^^\\
 *    //^ ^^ ^/6  6\ ^^ ^ \\
 *   //^ ^^ ^/( .. )\^ ^ ^ \\
 *  // ^^ ^/\| V""V|/\^ ^ ^ \\
 * //^^/\/ /  '~~'  \ \/\^ ^ \\
 *  ------------------------------------
 *  HERE BE DRAGONS
 *  
 *  Johan Dercksen - johan@draco.co.za
 */
using System;
using System.Linq;
using System.Text;
using System.Collections;
using System.ComponentModel;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace Cratos.Tools.General
{
	/// <summary>
	/// Cratos Data Object Collection Interface declaration
	/// </summary>
	public interface IDOCratosCollection<T> : IBindingList, IDOCratosCollectionBase where T : IDOCratos
	{
		#region Interface Events
		#endregion

		#region Interface Properties
		/// <summary>
		/// Maximum No of Records to load
		/// </summary>
		long MaxRecords { get; set; }

		/// <summary>
		/// Cratos Data Object
		/// </summary>
		T DataObject { get; set; }

		/// <summary>
		/// Data Object Collection Action
		/// </summary>
		DOCratosCollectionAction CollectionAction { get; set; }
		#endregion

		#region Interface Methods
		/// <summary>
		/// Validate the object against the current action
		/// </summary>
		/// <returns></returns>
		bool Validate();

		/// <summary>
		/// Create Serialize Stream from object
		/// </summary>
		/// <returns>
		/// A byte array of the serialized object
		/// </returns>
		byte[] CreateSerializeStream();

		/// <summary>
		/// Create Object from a Serialized object
		/// </summary>
		/// <param name="objectStream">A byte array representing the serialized object</param>
		/// <returns>
		/// The recreated object
		/// </returns>
		object CreateObjectFromStream(byte[] objectStream);
		#endregion
	}
}
